package com.erytech.linktalk.dao.domain;

import java.io.Serializable;
import java.sql.Timestamp;

public class User implements Serializable {

	public static final int MALE = 1;

	public static final int FEMALE = 2;

	public static final String ALL = "ALL";

	/**
	 * id = name:roomId
	 */
	String id;
	
	String name;
	
	String roomId;
	
	String description;
	
	int sex;
	
	String image;

	Timestamp creationTime;

	Timestamp lastPollTime;
	
	Timestamp lastPostTime;

	public Timestamp getLastPostTime() {
		return lastPostTime;
	}

	public void setLastPostTime(Timestamp lastPostTime) {
		this.lastPostTime = lastPostTime;
	}

	public String getId() {
		return id;
	}

	public void setId(String id) {
		this.id = id;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getImage() {
		return image;
	}

	public void setImage(String image) {
		this.image = image;
	}

	public int getSex() {
		return sex;
	}

	public void setSex(int sex) {
		this.sex = sex;
	}

	public Timestamp getCreationTime() {
		return creationTime;
	}

	public void setCreationTime(Timestamp loginTime) {
		this.creationTime = loginTime;
	}

	public Timestamp getLastPollTime() {
		return lastPollTime;
	}

	public void setLastPollTime(Timestamp lastPollTime) {
		this.lastPollTime = lastPollTime;
	}

	public String getRoomId() {
		return roomId;
	}

	public void setRoomId(String roomId) {
		this.roomId = roomId;
	}

	public String getDescription() {
		return description;
	}

	public void setDescription(String description) {
		this.description = description;
	}

	public static String createId(String name, String roomId) {
		if(name == null || roomId == null) {
			throw new IllegalArgumentException("The user has no name or roomId.");
		}
		return name + ":" + roomId;
	}
}
